package com.bigdata.demo.config;

/**
 *
 */
import java.util.Optional;
import java.util.concurrent.TimeUnit;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;




public class Listener {


    @KafkaListener(topics = { "f10-spark" },group = "sync-group")
    public void listen1(ConsumerRecord<?, ?> record) {
        Optional<?> kafkaMessage = Optional.ofNullable(record.value());
        Object obj = null ;
        if(kafkaMessage.isPresent()){
            String value = record.value().toString();
            System.out.println("sync-group:"+value);

        }



    }

    @KafkaListener(topics = { "f10-spark" },group = "test")
    public void listen2(ConsumerRecord<?, ?> record) {
        Optional<?> kafkaMessage = Optional.ofNullable(record.value());
        Object obj = null ;
        if(kafkaMessage.isPresent()){
            String value = record.value().toString();
            System.out.println("sync-group1:"+value);

        }



    }




}
